class AttendsSqlMap(object):
    GET_MY_TIMES = "SELECT t2.times_id,t2.start_time,t2.stop_time,t2.title FROM aoa_attends_plan AS t1 INNER JOIN aoa_attends_times AS t2 ON t1.period_id=t2.times_id WHERE t1.user_id={user_id} AND t1.datetime='{now_date}'"
    
    GET_MY_RECORD = "SELECT t1.start_time AS work_time,t1.end_time AS off_time,t2.status_name FROM aoa_attends_list AS t1 INNER JOIN aoa_status_list as t2 on t1.status_id=t2.status_id WHERE attends_user_id={user_id} AND attendce_times={times_id} AND attends_time LIKE '{now_date}%'"
    
    INSERT_RECORD = "INSERT INTO aoa_attends_record(record_time, user_id, have_status, start_work, attends_ip,period_id) VALUES(now(),{user_id},0,{start_or_end},'{user_ip}',{period_id})"
    
    UPDATE_END_ATTEND = "UPDATE aoa_attends_list al SET al.status_id={status_id},al.is_begin={is_begin},al.end_time='{end_time}' WHERE attends_period={period_id} AND datediff(now(), date(al.attends_date))<1"
    
    GET_PERIOD_BY_ID = "SELECT * FROM aoa_attends_period WHERE period_id={period_id}"
    
    ADD_ATTEND = "insert into aoa_attends_list (attends_time,status_id,type_id,attends_user_id,attend_hmtime,is_begin,start_time,attends_date,attendce_times,attends_period) " \
                 "values ('{attends_time}',{status_id},{type_id},{attends_user_id},'{attend_hmtime}',{is_begin},'{start_time}','{attends_date}','{attendce_times}',{period_id});"
    
    GET_PROCESS_BY_START_TIME = "SELECT * FROM aoa_process_list p WHERE p.is_checked=1 AND (p.type_name='请假申请' or " \
                                "p.type_name='出差申请' or p.type_name='外出申请') " \
                                "AND p.start_time<='{start_time}' AND p.end_time>='{start_time}' " \
                                "AND p.process_user_id={process_user_id} "

    GET_GROUP_BY_USERID = "SELECT * FROM aoa_attends_group WHERE group_id={group_id}"